﻿package view.component
{
    import __AS3__.vec.*;
    import cmd.*;
    import com.core.*;
    import com.greensock.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import consts.*;
    import flash.display.*;
    import flash.geom.*;
    import flash.utils.*;
    import manager.*;
    import morn.core.components.*;
    import morn.core.handlers.*;
    import plugin.fashen.model.*;
    import plugin.instances.*;
    import pluginfw.nio.*;
    import view.*;
    import view.component.activeBtns.*;
    import view.uilt.*;
    import vo.*;

    public class ActiveButtonGroup extends Sprite
    {
        public var btnArr:Array;
        public var operVec:Vector.<Object>;
        public var btnDic:Dictionary;
        public var btnGrid:Array;
        private var isDoing:Boolean = false;
        private var timeline:TimelineLite;
        private var isFirst:Boolean = true;
        private var firstVec:Vector.<Object>;
        private var timer:int = 0;
        private var timeEff:int = 0;
        private var timeCount:int = 0;
        private var timeDic:Dictionary;
        private var ratio:Number = 0.8;
        private var cfgStore:Array;
        private var _contrainer:Sprite;
        private var _cfgGuide:Object;
        private var objArr:Array;
        private var delayMsg:Dictionary;
        private var btn:Button;
        private var titleArr:Array;
        private var shape:Shape;
        private var serveropenday:int;
        private var curHeFuGoalMsg:Array;
        private var cfgHero:Object;
        private var cfgHeroLimit:Array;
        private var jihuoHeros:Array;
        private var curGongCeGoalMsg:Array;
        private var abState:Dictionary;

        public function ActiveButtonGroup()
        {
            this.operVec = new Vector.<Object>;
            this.btnDic = new Dictionary();
            this.btnGrid = [[], [], []];
            this.firstVec = new Vector.<Object>;
            this.timeDic = new Dictionary();
            this.cfgStore = [];
            this.delayMsg = new Dictionary();
            this.titleArr = [];
            this.cfgHero = ConfigDictionary.data.hero;
            this.cfgHeroLimit = ConfigDictionary.data.herolimit;
            this.jihuoHeros = [];
            this.abState = new Dictionary();
            var _loc_1:* = new Sprite();
            this.addChild(_loc_1);
            this.btnArr = ConfigDictionary.data.activeButton;
            this._contrainer = new Sprite();
            _loc_1.addChild(this._contrainer);
            UIVisibleManager.instance.register("activegroup", _loc_1, "up");
            this.btn = new Button("png.common.btn_unshow");
            _loc_1.addChild(this.btn);
            this.btn.x = 35;
            this.btn.y = -35;
            this.btn.clickHandler = new Handler(this.doClick);
            this._contrainer.x = 5;
            return;
        }// end function

        private function doClick() : void
        {
            if (this.btn.skin == "png.common.btn_unshow")
            {
                this.btn.skin = "png.common.btn_show";
                TweenLite.to(this._contrainer, 0.2, {y:-200});
                ModelProxy.change("guidepao", "hide", GuideType.GUIDE_FS);
            }
            else
            {
                this.btn.skin = "png.common.btn_unshow";
                TweenLite.to(this._contrainer, 0.2, {y:-0});
                this.fashentips("fashen");
            }
            return;
        }// end function

        public function initShow() : void
        {
            var _loc_1:Object = null;
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:Object = null;
            for each (_loc_1 in this.btnArr)
            {
                
                if (ActiveButtonUtil.checkShow(_loc_1))
                {
                    this.firstVec.push(_loc_1);
                }
            }
            _loc_2 = this.firstVec.length - 1;
            while (_loc_2 > 0)
            {
                
                _loc_3 = 0;
                while (_loc_3 < _loc_2)
                {
                    
                    if (int(this.firstVec[_loc_3].index) > int(this.firstVec[(_loc_3 + 1)].index))
                    {
                        _loc_4 = this.firstVec[_loc_3];
                        this.firstVec[_loc_3] = this.firstVec[(_loc_3 + 1)];
                        this.firstVec[(_loc_3 + 1)] = _loc_4;
                    }
                    _loc_3++;
                }
                _loc_2 = _loc_2 - 1;
            }
            if (UserData.getUserData("level") >= 49)
            {
                this._contrainer.x = 10;
            }
            else
            {
                this._contrainer.x = 5;
            }
            this.firstLoad();
            return;
        }// end function

        private function firstLoad() : void
        {
            var _loc_1:Object = null;
            if (this.firstVec.length > 0)
            {
                _loc_1 = this.firstVec.shift();
                if (_loc_1.name == "horse" && Config.hexie)
                {
                    App.mloader3.loadSWF(Config.getUrl("assets/images/activeButton/" + "oldhorse" + ".swf"), 1, new Handler(this.firstLoadComp, [_loc_1]), null, null, false);
                }
                else
                {
                    App.mloader3.loadSWF(Config.getUrl("assets/images/activeButton/" + _loc_1.name + ".swf"), 1, new Handler(this.firstLoadComp, [_loc_1]), null, null, false);
                }
            }
            else
            {
                this.isFirst = false;
                this.firstVec = null;
                this.doNext();
            }
            return;
        }// end function

        private function firstLoadComp(param1:Object, param2) : void
        {
            this.doLoadComp(param1, param2);
            this.firstLoad();
            return;
        }// end function

        private function doLoadComp(param1:Object, param2) : ActiveButton
        {
            var _loc_3:ActiveButton = null;
            var _loc_4:Class = null;
            switch(param1.cls)
            {
                case "1":
                {
                    _loc_4 = ShouCangBtn;
                    break;
                }
                case "2":
                {
                    _loc_4 = JhzButton;
                    break;
                }
                default:
                {
                    _loc_4 = ActiveButton;
                    break;
                    break;
                }
            }
            _loc_3 = new _loc_4(param1);
            this._contrainer.addChild(_loc_3);
            _loc_3.y = param1.group * 70 + (param1.sizeY - 1) * 35;
            this.btnDic[param1.name] = _loc_3;
            this.checkPos(param1, _loc_3);
            if (param1.showDay)
            {
                this.showDay(_loc_3, param1);
            }
            if (param1.tips)
            {
                _loc_3.toolTips = param1.tips;
            }
            if (param1.type > 1)
            {
                if (param1.name == "achievement")
                {
                    this.checkActivity();
                }
                if (param1.name == "goddess")
                {
                    this.checkGoddess();
                }
            }
            this.specialOper(param1, _loc_3);
            UIGlobel.pointsDic[param1.name] = _loc_3.localToGlobal(new Point(0, 0));
            if (param1.name == "fashen")
            {
                this.fashentips("fashen");
            }
            return _loc_3;
        }// end function

        public function checkPos(param1:Object, param2:ActiveButton, param3:int = 0) : void
        {
            var _loc_11:int = 0;
            var _loc_12:int = 0;
            var _loc_13:int = 0;
            var _loc_4:* = this.btnGrid[int(param1.group) + param3];
            var _loc_5:* = this.btnGrid[int(param1.group) + param3].length;
            var _loc_6:* = param1.index;
            var _loc_7:* = param1.name;
            var _loc_8:Boolean = true;
            var _loc_9:int = 0;
            while (_loc_9 < _loc_5)
            {
                
                if (_loc_4[_loc_9].index > _loc_6)
                {
                    _loc_11 = _loc_5 - 1;
                    while (_loc_11 >= _loc_9)
                    {
                        
                        _loc_4[_loc_11 + int(param1.sizeX)] = _loc_4[_loc_11];
                        TweenLite.to(this.btnDic[_loc_4[_loc_11].name], 1, {x:(-(_loc_11 + int(param1.sizeX))) * 70 * this.ratio});
                        _loc_11 = _loc_11 - 1;
                    }
                    _loc_12 = 0;
                    while (_loc_12 < param1.sizeX)
                    {
                        
                        _loc_4[_loc_9 + _loc_12] = {index:_loc_6, name:_loc_7};
                        _loc_12++;
                    }
                    param2.x = (-(_loc_9 + int(param1.sizeX) - 1)) * 70 * this.ratio + (param1.sizeX - 1) * 35;
                    _loc_8 = false;
                    if (param3 < (param1.sizeY - 1))
                    {
                        this.checkPos(param1, param2, (param3 + 1));
                    }
                    break;
                }
                _loc_9++;
            }
            if (_loc_8)
            {
                _loc_13 = 0;
                while (_loc_13 < param1.sizeX)
                {
                    
                    _loc_4.push({index:_loc_6, name:_loc_7});
                    _loc_13++;
                }
                param2.x = (-(_loc_5 + int(param1.sizeX) - 1)) * 70 * this.ratio + (param1.sizeX - 1) * 35;
                if (param3 < (param1.sizeY - 1))
                {
                    this.checkPos(param1, param2, (param3 + 1));
                }
            }
            var _loc_10:* = this.btnDic["360group"];
            if (this.btnDic["360group"] != null)
            {
                this._contrainer.setChildIndex(_loc_10, (this._contrainer.numChildren - 1));
            }
            return;
        }// end function

        public function updateBtn() : void
        {
            var _loc_1:Object = null;
            for each (_loc_1 in this.btnArr)
            {
                
                if (this.btnDic[_loc_1.name] == null)
                {
                    if (ActiveButtonUtil.checkShow(_loc_1))
                    {
                        this.addBtn(_loc_1.name);
                    }
                }
            }
            return;
        }// end function

        public function updateBtnShow(param1:String) : void
        {
            var _loc_2:* = this.getBtnMsg(param1);
            if (_loc_2)
            {
                if (this.btnDic[param1])
                {
                    if (!ActiveButtonUtil.checkShow(_loc_2))
                    {
                        this.removeBtn(param1);
                    }
                }
                else if (ActiveButtonUtil.checkShow(_loc_2))
                {
                    this.addBtn(_loc_2.name);
                }
            }
            return;
        }// end function

        public function fashentips(param1:String, param2:String = "你OUT了，竟然没有召唤法神伴随战斗，战斗效率会很低 的。") : void
        {
            var _loc_3:int = 0;
            if (UserData.getUserData("level") >= 22 && UIGlobel.pointsDic[param1] && this.btn.skin == "png.common.btn_unshow")
            {
                _loc_3 = ModelProxy.getValue("mainui", "chuzhanHero");
                if (_loc_3 != 1)
                {
                    GuideView.getInstance().doGuide(GuideType.GUIDE_FS);
                }
            }
            return;
        }// end function

        public function openspecialper() : void
        {
            var _loc_1:* = new Object();
            _loc_1.name = "activity";
            this.specialOper(_loc_1, this.btnDic["activity"]);
            return;
        }// end function

        private function specialOper(param1:Object, param2:ActiveButton) : void
        {
            var _loc_3:Output = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:Object = null;
            var _loc_8:int = 0;
            var _loc_9:int = 0;
            var _loc_10:Date = null;
            var _loc_11:Array = null;
            var _loc_12:String = null;
            var _loc_13:Array = null;
            var _loc_14:int = 0;
            var _loc_15:Array = null;
            var _loc_16:Object = null;
            var _loc_17:Array = null;
            var _loc_18:Object = null;
            var _loc_19:Object = null;
            var _loc_20:int = 0;
            var _loc_21:int = 0;
            var _loc_22:Boolean = false;
            var _loc_23:int = 0;
            var _loc_24:int = 0;
            var _loc_25:Number = NaN;
            var _loc_26:int = 0;
            var _loc_27:int = 0;
            var _loc_28:Object = null;
            var _loc_29:Boolean = false;
            var _loc_30:Object = null;
            var _loc_31:Array = null;
            var _loc_32:Object = null;
            var _loc_33:Object = null;
            var _loc_34:Object = null;
            var _loc_35:Object = null;
            var _loc_36:String = null;
            var _loc_37:Boolean = false;
            var _loc_38:int = 0;
            var _loc_39:Array = null;
            var _loc_40:Boolean = false;
            var _loc_41:Array = null;
            if (param2 == null)
            {
                return;
            }
            switch(param1.name)
            {
                case "activity":
                {
                    _loc_6 = UserData.getUserData("level");
                    _loc_7 = ConfigDictionary.data.openlevel;
                    _loc_8 = UserData.getOnlineData("curid");
                    _loc_9 = UserData.getOnlineData("lixiantime");
                    _loc_5 = int((ModelProxy.getValue("data", "servertime") + Number(getTimer())) / 1000);
                    _loc_10 = new Date(_loc_5 * 1000);
                    _loc_11 = ConfigDictionary.data.online;
                    _loc_12 = UserData.getOnlineData("qd");
                    _loc_13 = _loc_12.split("#");
                    if (_loc_8 >= 5 && int(_loc_9 / 3600) < 1 && _loc_13[(_loc_10.date - 1)] == 1)
                    {
                        param2.doTimeVisible(false);
                        param2.doAngleVisible(false);
                        param2.deleteEffect();
                        return;
                    }
                    _loc_22 = true;
                    _loc_23 = 0;
                    _loc_24 = UserData.getOnlineData("ontime");
                    _loc_25 = UserData.getOnlineData("lastupdate");
                    _loc_26 = _loc_5 - int(_loc_25 / 1000) + _loc_24;
                    if (_loc_6 >= _loc_7["activity"][2].level)
                    {
                        if (_loc_8 < 5)
                        {
                            if (this.timeEff > 0)
                            {
                                clearInterval(this.timeEff);
                                this.timeEff = 0;
                            }
                            if (this.timeEff == 0)
                            {
                                this.timeEff = setInterval(this.doAddeffect, 1000);
                            }
                        }
                    }
                    _loc_4 = _loc_8;
                    while (_loc_4 < 5)
                    {
                        
                        _loc_27 = int(_loc_11[_loc_4].time) * 60;
                        if (_loc_26 < _loc_27)
                        {
                            param2.curtime = _loc_27 - _loc_26;
                            var _loc_42:String = this;
                            var _loc_43:* = this.timeCount + 1;
                            _loc_42.timeCount = _loc_43;
                            this.timeDic[param1.name] = param2.doTime;
                            if (this.timer == 0)
                            {
                                this.timer = setInterval(this.doTime, 1000);
                            }
                            _loc_22 = false;
                            break;
                        }
                        _loc_23++;
                        _loc_4++;
                    }
                    if (_loc_22)
                    {
                        param2.doTimeVisible(false);
                    }
                    if (_loc_23 > 0)
                    {
                        param2.doAngleVisible(true);
                        param2.addEffect();
                    }
                    else
                    {
                        param2.doAngleVisible(false);
                        param2.deleteEffect();
                    }
                    if (_loc_6 >= _loc_7["activity"][3].level)
                    {
                        if (int(_loc_9 / 3600) >= 1)
                        {
                            param2.addEffect();
                        }
                    }
                    if (_loc_6 >= _loc_7["activity"][1].level)
                    {
                        if (_loc_13[(_loc_10.date - 1)] == 0)
                        {
                            param2.addEffect();
                        }
                    }
                    break;
                }
                case "qryl":
                {
                    if (this.delayMsg["qryl"])
                    {
                        this.showEffect(this.delayMsg["qryl"]);
                        delete this.delayMsg["qryl"];
                    }
                    break;
                }
                case "juhunzhu":
                {
                    if (this.delayMsg["juhunzhu"])
                    {
                        this.updateJuHunZhu(this.delayMsg["juhunzhu"]);
                        delete this.delayMsg["juhunzhu"];
                    }
                    break;
                }
                case "baifu":
                {
                    if (this.delayMsg["baifu"])
                    {
                        this.showEffect(this.delayMsg["baifu"]);
                        delete this.delayMsg["baifu"];
                    }
                    break;
                }
                case "fcactivity":
                {
                    _loc_3 = new Output();
                    _loc_3.writeShort(2);
                    _loc_3.writeVarInt(9, false);
                    _loc_3.writeVarInt(10, false);
                    PluginManager.instance.sendToBufferServer("kaifujingji", CMDKaifuJJ.SendgoalInfoMassage, _loc_3);
                    break;
                }
                case "kaifujingji":
                {
                    this.serveropenday = int(ModelProxy.getValue("data", "openday")) + 1;
                    _loc_3 = new Output();
                    PluginManager.instance.sendToBufferServer("kaifujingji", CMDKaifuJJ.AskBossStateInfoMessage, _loc_3);
                    _loc_15 = [];
                    _loc_16 = ConfigDictionary.data.activitytime;
                    for each (_loc_28 in _loc_16)
                    {
                        
                        if (_loc_28.activetype == 1)
                        {
                            this.titleArr[_loc_28.id] = _loc_28.id;
                            if (_loc_15[_loc_28.id] == null)
                            {
                                _loc_15[_loc_28.id] = new Array();
                            }
                            (_loc_15[_loc_28.id] as Array).push(_loc_28);
                        }
                    }
                    _loc_17 = [];
                    _loc_14 = 1;
                    while (_loc_14 < _loc_15.length)
                    {
                        
                        if (_loc_15[_loc_14][0].type != 0)
                        {
                            _loc_29 = this.yeqian(_loc_15[_loc_14][1]);
                            if (_loc_29)
                            {
                                _loc_17.push(this.titleArr[_loc_14]);
                            }
                        }
                        _loc_14++;
                    }
                    if (_loc_17.length != 0)
                    {
                        _loc_3 = new Output();
                        _loc_3.writeShort(_loc_17.length);
                        _loc_14 = 0;
                        while (_loc_14 < _loc_17.length)
                        {
                            
                            _loc_3.writeVarInt(_loc_17[_loc_14], false);
                            _loc_14++;
                        }
                        PluginManager.instance.sendToBufferServer("kaifujingji", CMDKaifuJJ.SendgoalInfoMassage, _loc_3);
                    }
                    break;
                }
                case "xunbaoshop":
                {
                    _loc_18 = ConfigDictionary.data.storeMsg[2];
                    _loc_19 = ConfigDictionary.data.item;
                    _loc_20 = UserData.getUserData("career");
                    _loc_21 = UserData.getUserData("sex");
                    for (_loc_30 in _loc_18)
                    {
                        
                        if (_loc_30 == 3 || _loc_30 == 5)
                        {
                            continue;
                        }
                        _loc_31 = _loc_18[_loc_30];
                        this.cfgStore[_loc_30] = [];
                        for each (_loc_32 in _loc_31)
                        {
                            
                            _loc_33 = ItemObject.create(_loc_19[_loc_32.itemid]);
                            if (_loc_33)
                            {
                                if (_loc_33.career > 0)
                                {
                                    if (_loc_33.career != _loc_20)
                                    {
                                        continue;
                                    }
                                }
                                if (_loc_30 != 3)
                                {
                                    if (_loc_33.sex != 2)
                                    {
                                        if (_loc_33.sex != _loc_21)
                                        {
                                            continue;
                                        }
                                    }
                                }
                                if (_loc_32.request)
                                {
                                    _loc_39 = _loc_32.request.split("&");
                                    _loc_40 = false;
                                    _loc_4 = 0;
                                    while (_loc_4 < _loc_39.length)
                                    {
                                        
                                        if (this.checkCondition(_loc_39[_loc_4]))
                                        {
                                            _loc_40 = true;
                                            break;
                                        }
                                        _loc_4++;
                                    }
                                    if (_loc_40)
                                    {
                                        continue;
                                    }
                                }
                                _loc_34 = ConfigDictionary.data.item;
                                _loc_35 = ItemObject.create(_loc_34[_loc_32.costtype]);
                                _loc_36 = _loc_32.nowprice + _loc_35.name;
                                _loc_37 = false;
                                if (_loc_32.needitems)
                                {
                                    _loc_41 = _loc_32.needitems.split("#");
                                    _loc_37 = ItemUilt.getAllCount(_loc_41[0]) < _loc_41[1];
                                }
                                _loc_38 = this.getMoney(_loc_32.costtype);
                                if (_loc_32.nowprice > _loc_38)
                                {
                                    continue;
                                }
                                else if (_loc_37)
                                {
                                    continue;
                                }
                                else
                                {
                                    param2.addEffect();
                                    return;
                                }
                                continue;
                            }
                            continue;
                        }
                    }
                    param2.deleteEffect();
                    break;
                }
                case "lianzhiexp":
                {
                    this.lianZhiTime();
                    break;
                }
                case "gongce":
                {
                    this.checkGongce();
                    break;
                }
                case "hefu":
                {
                    this.checkHeFu();
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        private function checkHeFu() : void
        {
            var _loc_2:ItemSplit = null;
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            var _loc_5:Object = null;
            var _loc_6:Object = null;
            var _loc_7:Object = null;
            var _loc_8:Boolean = false;
            var _loc_9:Object = null;
            var _loc_10:Object = null;
            var _loc_11:int = 0;
            var _loc_12:Object = null;
            var _loc_13:Object = null;
            var _loc_14:Object = null;
            var _loc_1:* = this.btnDic["hefu"];
            if (_loc_1)
            {
                if (this.curGongCeGoalMsg == null)
                {
                    _loc_7 = ConfigDictionary.data.activitygoal;
                    this.curHeFuGoalMsg = _loc_7[19];
                }
                _loc_2 = new ItemSplit();
                for each (_loc_3 in this.curHeFuGoalMsg)
                {
                    
                    _loc_3.itemArr = _loc_2.doSplits(_loc_3.goalname, "/", "&", "#")[0];
                    _loc_8 = true;
                    for each (_loc_9 in _loc_3.itemArr)
                    {
                        
                        if (ItemUilt.getAllCount(_loc_9.itemid) < _loc_9.count)
                        {
                            _loc_8 = false;
                            break;
                        }
                    }
                    if (_loc_8)
                    {
                        _loc_1.addEffect();
                        return;
                    }
                }
                if (UserData.getUserData("rein") >= 1)
                {
                    _loc_10 = ModelProxy.getValue("data", "jingjitypedata")[15];
                    _loc_11 = ModelProxy.getValue("data", "hefuloginday");
                    if (_loc_10 == null)
                    {
                        _loc_1.deleteEffect();
                    }
                    else
                    {
                        for each (_loc_13 in _loc_10[0])
                        {
                            
                            if (_loc_13.isGet == 0)
                            {
                                if (_loc_13.goal <= _loc_11)
                                {
                                    _loc_1.addEffect();
                                    return;
                                }
                            }
                        }
                    }
                }
                _loc_4 = ModelProxy.getValue("data", "hefusabakemsg");
                _loc_5 = ModelProxy.getValue("data", "jingjitypedata")[17];
                for each (_loc_6 in _loc_4)
                {
                    
                    if (UserData.getUserData("rid") == _loc_6.rid)
                    {
                        if (_loc_5 != null)
                        {
                            for each (_loc_14 in _loc_5[0])
                            {
                                
                                if (_loc_14.goal == _loc_6.hefuDay)
                                {
                                    if (_loc_14.isGet == 0)
                                    {
                                        _loc_1.addEffect();
                                        return;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
                _loc_1.deleteEffect();
            }
            return;
        }// end function

        private function lianZhiTime() : void
        {
            var _loc_2:int = 0;
            var _loc_3:Date = null;
            var _loc_4:int = 0;
            var _loc_5:Date = null;
            var _loc_1:* = this.btnDic["lianzhiexp"];
            if (_loc_1)
            {
                _loc_2 = int((ModelProxy.getValue("data", "servertime") + Number(getTimer())) / 1000);
                _loc_3 = new Date();
                _loc_3.setTime(_loc_2 * 1000);
                _loc_4 = _loc_3.getHours();
                if (_loc_4 >= 20)
                {
                    _loc_5 = new Date(_loc_3.fullYear, _loc_3.month, _loc_3.date, 23, 59, 59, 59);
                    _loc_1.doAngleVisible(true);
                }
                else
                {
                    _loc_5 = new Date(_loc_3.fullYear, _loc_3.month, _loc_3.date, 19, 59, 59, 59);
                    _loc_1.doAngleVisible(false);
                }
                setTimeout(this.lianZhiTime, _loc_5.getTime() - _loc_3.getTime() + 1000);
            }
            return;
        }// end function

        public function checkXunbaoshop() : void
        {
            if (!ModelProxy.getValue("data", "xunbaoshopIsOpen"))
            {
                this.specialOper({name:"xunbaoshop"}, this.btnDic["xunbaoshop"]);
            }
            return;
        }// end function

        private function getMoney(param1:int) : Number
        {
            var _loc_2:* = UserData.getBagData();
            var _loc_3:Number = 0;
            switch(param1)
            {
                case 1:
                {
                    _loc_3 = _loc_2.bgold;
                    break;
                }
                case 3:
                {
                    _loc_3 = _loc_2.money;
                    break;
                }
                case 2:
                {
                    _loc_3 = _loc_2.bonus;
                    break;
                }
                case 5:
                {
                    _loc_3 = _loc_2.contribution;
                    break;
                }
                case 6:
                {
                    _loc_3 = _loc_2.gold;
                    break;
                }
                case 9:
                {
                    _loc_3 = _loc_2.zuoqi;
                    break;
                }
                case 10:
                {
                    _loc_3 = _loc_2.yuyi;
                    break;
                }
                case 11:
                {
                    _loc_3 = _loc_2.shengwang;
                    break;
                }
                case 15:
                {
                    _loc_3 = _loc_2.jifen;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return _loc_3;
        }// end function

        private function checkCondition(param1:String) : Boolean
        {
            var _loc_2:Array = null;
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            _loc_2 = param1.split("#");
            switch(int(_loc_2[0]))
            {
                case 0:
                {
                    break;
                }
                case 1:
                {
                    _loc_3 = ModelProxy.getValue("data", "achievement");
                    _loc_4 = _loc_3["a" + _loc_2[1]];
                    if (_loc_4 && _loc_4[1] > 0)
                    {
                        return false;
                    }
                    break;
                }
                case 2:
                {
                    _loc_3 = ModelProxy.getValue("data", "achievement");
                    if (_loc_3.res >= _loc_2[1])
                    {
                        return false;
                    }
                    break;
                }
                case 3:
                {
                    _loc_5 = UserData.getUserData("level");
                    if (_loc_5 >= _loc_2[1])
                    {
                        return false;
                    }
                    break;
                }
                case 13:
                {
                    _loc_6 = UserData.getUserData("rein");
                    if (_loc_6 >= _loc_2[1])
                    {
                        return false;
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
            return true;
        }// end function

        private function doAddeffect() : void
        {
            var _loc_1:* = UserData.getOnlineData("curid");
            var _loc_2:* = UserData.getOnlineData("ontime");
            var _loc_3:* = int((ModelProxy.getValue("data", "servertime") + Number(getTimer())) / 1000);
            var _loc_4:* = ConfigDictionary.data.online;
            var _loc_5:* = UserData.getOnlineData("lastupdate");
            if (_loc_1 < 5)
            {
                if (_loc_3 - int(_loc_5 / 1000) + _loc_2 >= int(_loc_4[_loc_1].time) * 60)
                {
                    this.openOnline();
                }
            }
            else
            {
                clearInterval(this.timeEff);
                this.timeEff = 0;
            }
            return;
        }// end function

        private function showDay(param1:ActiveButton, param2:Object) : void
        {
            var _loc_3:* = int((ModelProxy.getValue("data", "servertime") + Number(getTimer())) / 1000);
            var _loc_4:* = new Date();
            new Date().setTime(_loc_3 * 1000);
            var _loc_5:* = new Date(_loc_4.fullYear, _loc_4.month, _loc_4.date, 23, 59, 59, 59);
            param1.curtime = _loc_5.getTime() / 1000 - _loc_3 + (param2.showDay - ModelProxy.getValue("data", "openday")) * 86400;
            var _loc_6:String = this;
            var _loc_7:* = this.timeCount + 1;
            _loc_6.timeCount = _loc_7;
            this.timeDic[param2.name] = param1.doTime;
            if (this.timer == 0)
            {
                this.timer = setInterval(this.doTime, 1000);
            }
            return;
        }// end function

        private function doTime() : void
        {
            var _loc_1:String = null;
            for (_loc_1 in this.timeDic)
            {
                
                var _loc_4:* = this.timeDic;
                if (_loc_4.this.timeDic[_loc_1]())
                {
                    delete this.timeDic[_loc_1];
                    var _loc_4:String = this;
                    var _loc_5:* = this.timeCount - 1;
                    _loc_4.timeCount = _loc_5;
                    if (this.timeCount == 0)
                    {
                        if (this.timer > 0)
                        {
                            clearInterval(this.timer);
                        }
                        this.timer = 0;
                        return;
                    }
                }
            }
            return;
        }// end function

        private function doNext() : void
        {
            var _loc_1:ActiveButton = null;
            var _loc_2:Object = null;
            var _loc_3:Object = null;
            if (this.isFirst)
            {
                return;
            }
            if (this.isDoing)
            {
                return;
            }
            if (this.operVec.length > 0)
            {
                this.isDoing = true;
                _loc_2 = this.operVec.shift();
                _loc_3 = _loc_2.msg;
                switch(_loc_2.oper)
                {
                    case 1:
                    {
                        _loc_1 = this.btnDic[_loc_3.name];
                        if (_loc_1)
                        {
                            this.isDoing = false;
                            this.doNext();
                            return;
                        }
                        App.mloader3.loadSWF(Config.getUrl("assets/images/activeButton/" + _loc_3.name + ".swf"), 1, new Handler(this.loadComp, [_loc_3]), null, null, false);
                        break;
                    }
                    case 2:
                    {
                        _loc_1 = this.btnDic[_loc_3.name];
                        if (!_loc_1)
                        {
                            this.isDoing = false;
                            this.doNext();
                            return;
                        }
                        this.doRemove(_loc_3);
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            return;
        }// end function

        private function doRemove(param1:Object) : void
        {
            var _loc_8:int = 0;
            var _loc_2:* = this.btnDic[param1.name];
            var _loc_3:* = this.btnGrid[param1.group];
            var _loc_4:* = _loc_3.length;
            var _loc_5:* = param1.index;
            var _loc_6:* = param1.name;
            var _loc_7:int = 0;
            while (_loc_7 < _loc_4)
            {
                
                if (_loc_3[_loc_7].index == _loc_5)
                {
                    _loc_8 = _loc_7;
                    while (_loc_8 < (_loc_4 - 1))
                    {
                        
                        _loc_3[_loc_8] = _loc_3[(_loc_8 + 1)];
                        TweenLite.to(this.btnDic[_loc_3[_loc_8].name], 1, {x:(-_loc_8) * 70 * this.ratio});
                        _loc_8++;
                    }
                    delete this.btnDic[param1.name];
                    if (param1.type == 1)
                    {
                        delete this.timeDic[param1.name];
                    }
                    _loc_3.pop();
                    break;
                }
                _loc_7++;
            }
            this.doRemoveAnimate(_loc_2);
            _loc_2.disposeLeaf();
            if (param1.change != "")
            {
                this.addBtn(param1.change);
            }
            return;
        }// end function

        public function updateShouchong() : void
        {
            if (ModelProxy.getValue("data", "roledata.shouchong") == 2)
            {
                this.removeBtn("shouchong");
            }
            return;
        }// end function

        private function doShow(param1:Array, param2:ActiveButton, param3:int = 0) : void
        {
            var _loc_5:Object = null;
            if (param1.length == 0)
            {
                param1 = null;
                return;
            }
            var _loc_4:* = param1.shift();
            if (!this.btnDic[_loc_4])
            {
                _loc_5 = this.getBtnMsg(_loc_4);
                App.mloader3.loadSWF(Config.getUrl("assets/images/activeButton/" + _loc_4 + ".swf"), 1, new Handler(this.loadComp, [_loc_5]), null, null, false);
            }
            else
            {
                this.doShow(param1, null);
            }
            return;
        }// end function

        private function getBtnMsg(param1:String) : Object
        {
            var _loc_2:Object = null;
            for each (_loc_2 in this.btnArr)
            {
                
                if (_loc_2.name == param1)
                {
                    return _loc_2;
                }
            }
            return null;
        }// end function

        private function doRemoveAnimate(param1:ActiveButton) : void
        {
            this.timeline = new TimelineLite();
            this.timeline.append(new TweenLite(param1, 1, {scaleX:0, scaleY:0, rotation:1080, onComplete:this.animateComp, onCompleteParams:[param1]}));
            return;
        }// end function

        private function loadComp(param1:Object, param2) : void
        {
            this.doShowAnimate(this.doLoadComp(param1, param2));
            return;
        }// end function

        private function doShowAnimate(param1:ActiveButton) : void
        {
            var _loc_2:int = 0;
            param1.scaleY = 0;
            param1.scaleX = _loc_2;
            this.timeline = new TimelineLite();
            this.timeline.append(new TweenLite(param1, 1, {scaleX:1, scaleY:1, rotation:1080}));
            this.timeline.append(new TweenMax(param1, 0.5, {glowFilter:{color:16763904, alpha:1, blurX:50, blurY:50}}));
            this.timeline.append(new TweenMax(param1, 0.5, {glowFilter:{color:16763904, alpha:0, blurX:50, blurY:50}, onComplete:this.animateComp, onCompleteParams:[param1]}));
            return;
        }// end function

        public function animateComp(param1:ActiveButton) : void
        {
            param1.filters = null;
            this.timeline.kill();
            this.timeline = null;
            this.isDoing = false;
            this.doNext();
            return;
        }// end function

        public function addBtn(param1:String) : void
        {
            this.setToOper(param1, 1);
            return;
        }// end function

        public function removeBtn(param1:String) : void
        {
            this.setToOper(param1, 2);
            return;
        }// end function

        public function setToOper(param1:String, param2:int) : void
        {
            var _loc_3:Object = null;
            for each (_loc_3 in this.btnArr)
            {
                
                if (_loc_3.name == param1)
                {
                    this.operVec.push({msg:_loc_3, oper:param2});
                    this.doNext();
                    return;
                }
            }
            return;
        }// end function

        public function doShake(param1:String) : void
        {
            var _loc_3:Object = null;
            var _loc_4:TimelineLite = null;
            var _loc_2:* = this.btnDic[param1];
            if (_loc_2)
            {
                _loc_3 = _loc_2.btnMsg;
                _loc_4 = new TimelineLite();
                _loc_4.append(new TweenLite(_loc_2, 0.2, {y:_loc_3.group * 70 - 10 + (_loc_3.sizeY - 1) * 35}));
                _loc_4.append(new TweenLite(_loc_2, 0.4, {y:_loc_3.group * 70 + (_loc_3.sizeY - 1) * 35, onComplete:this.shakeComp, onCompleteParams:[_loc_4]}));
            }
            return;
        }// end function

        public function shakeComp(param1:TimelineLite) : void
        {
            param1.kill();
            param1 = null;
            return;
        }// end function

        public function updateOnline() : void
        {
            var _loc_1:* = this.btnDic["activity"];
            if (_loc_1)
            {
                _loc_1.doAngleVisible(false);
                _loc_1.deleteEffect();
            }
            return;
        }// end function

        public function openOnline() : void
        {
            var _loc_1:* = this.btnDic["activity"];
            var _loc_2:* = UserData.getOnlineData("curid");
            if (_loc_1)
            {
                _loc_1.addEffect();
            }
            if (_loc_2 >= 5)
            {
                if (this.timeEff > 0)
                {
                    clearInterval(this.timeEff);
                    this.timeEff = 0;
                }
            }
            return;
        }// end function

        public function checkGoddess() : void
        {
            var _loc_2:Boolean = false;
            var _loc_3:int = 0;
            var _loc_4:Object = null;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_1:* = this.btnDic["goddess"];
            if (_loc_1)
            {
                if (_loc_1._btnMsg.type > 1)
                {
                    _loc_2 = ModelProxy.getValue("data", "option.showgncount") == 1 ? (true) : (false);
                    if (_loc_2 == true)
                    {
                        _loc_3 = 0;
                        _loc_4 = UserData.getOnlineData("MBtime");
                        if (_loc_4)
                        {
                            _loc_5 = _loc_4[1];
                            _loc_6 = 0;
                            _loc_6 = 2;
                            _loc_3 = _loc_3 + (_loc_6 - _loc_5);
                            _loc_5 = _loc_4[0];
                            _loc_3 = _loc_3 + (_loc_6 - _loc_5);
                        }
                        if (_loc_3 > 0)
                        {
                            _loc_1._angletxt.text = _loc_3.toString();
                            _loc_1.doAngleVisible(true);
                        }
                        else
                        {
                            _loc_1.doAngleVisible(false);
                        }
                    }
                    else
                    {
                        _loc_1.doAngleVisible(false);
                    }
                }
            }
            return;
        }// end function

        public function checkActivity() : void
        {
            var _loc_2:Boolean = false;
            var _loc_3:Object = null;
            var _loc_4:int = 0;
            var _loc_5:String = null;
            var _loc_1:* = this.btnDic["achievement"];
            if (_loc_1)
            {
                if (_loc_1._btnMsg.type > 1)
                {
                    _loc_2 = ModelProxy.getValue("data", "option.showgncount") == 1 ? (true) : (false);
                    if (_loc_2 == true)
                    {
                        _loc_3 = ModelProxy.getValue("data", "achievement");
                        _loc_4 = 0;
                        for (_loc_5 in _loc_3)
                        {
                            
                            if (_loc_5.indexOf("a") == 0)
                            {
                                if (_loc_3[_loc_5][1] == 1)
                                {
                                    _loc_4++;
                                }
                            }
                        }
                        if (_loc_4 > 0)
                        {
                            _loc_1._angletxt.text = _loc_4.toString();
                            _loc_1.doAngleVisible(true);
                        }
                        else
                        {
                            _loc_1.doAngleVisible(false);
                        }
                    }
                    else
                    {
                        _loc_1.doAngleVisible(false);
                    }
                }
            }
            return;
        }// end function

        public function setTimeShow(param1:Object) : void
        {
            var _loc_2:* = this.btnDic[param1.name];
            _loc_2.setTimeShow(param1.time);
            var _loc_3:String = this;
            var _loc_4:* = this.timeCount + 1;
            _loc_3.timeCount = _loc_4;
            this.timeDic[param1.name] = _loc_2.doTime;
            if (this.timer == 0)
            {
                this.timer = setInterval(this.doTime, 1000);
            }
            return;
        }// end function

        public function chuzhanHero(param1:Object) : void
        {
            var _loc_2:* = this.btnDic["fashen"];
            if (param1 == 1)
            {
                if (_loc_2)
                {
                    _loc_2.deleteEffect();
                }
            }
            else if (_loc_2)
            {
                _loc_2.addEffect();
            }
            return;
        }// end function

        public function showJihuoHero(param1:Object) : void
        {
            this.jihuoHeros = param1 as Array;
            this.showJiHuoHeros();
            return;
        }// end function

        public function jihuoHero(param1:Object) : void
        {
            this.jihuoHeros.push(param1);
            this.showJiHuoHeros();
            return;
        }// end function

        public function checkGongce() : void
        {
            var _loc_2:ItemSplit = null;
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            var _loc_5:Boolean = false;
            var _loc_6:Object = null;
            var _loc_1:* = this.btnDic["gongce"];
            if (_loc_1)
            {
                if (this.curGongCeGoalMsg == null)
                {
                    _loc_4 = ConfigDictionary.data.activitygoal;
                    this.curGongCeGoalMsg = _loc_4[12];
                }
                _loc_2 = new ItemSplit();
                for each (_loc_3 in this.curGongCeGoalMsg)
                {
                    
                    _loc_3.itemArr = _loc_2.doSplits(_loc_3.goalname, "/", "&", "#")[0];
                    _loc_5 = true;
                    for each (_loc_6 in _loc_3.itemArr)
                    {
                        
                        if (ItemUilt.getAllCount(_loc_6.itemid) < _loc_6.count)
                        {
                            _loc_5 = false;
                            break;
                        }
                    }
                    if (_loc_5)
                    {
                        _loc_1.addEffect();
                        return;
                    }
                }
                _loc_1.deleteEffect();
            }
            return;
        }// end function

        public function updateBag() : void
        {
            this.checkGongce();
            this.checkHeFu();
            return;
        }// end function

        public function showJiHuoHeros() : void
        {
            var _loc_2:Object = null;
            var _loc_3:Array = null;
            var _loc_4:Object = null;
            var _loc_5:Boolean = false;
            var _loc_6:Object = null;
            var _loc_7:ActiveButton = null;
            var _loc_8:int = 0;
            var _loc_9:String = null;
            var _loc_10:String = null;
            var _loc_11:Array = null;
            var _loc_12:Array = null;
            var _loc_13:Array = null;
            var _loc_14:Array = null;
            var _loc_15:String = null;
            var _loc_16:String = null;
            var _loc_17:int = 0;
            var _loc_18:Array = null;
            var _loc_19:int = 0;
            var _loc_20:Array = null;
            var _loc_1:Array = [];
            for each (_loc_2 in this.jihuoHeros)
            {
                
                _loc_1[_loc_2.heroid] = _loc_2.heroid;
            }
            _loc_3 = [];
            for each (_loc_4 in this.cfgHero)
            {
                
                if (!_loc_1[int(_loc_4.heroid)])
                {
                    if (int(_loc_4.level) == 1)
                    {
                        _loc_3[int(_loc_4.id)] = _loc_4.heroid;
                    }
                }
            }
            _loc_5 = false;
            for each (_loc_6 in _loc_3)
            {
                
                _loc_8 = this.cfgHero[_loc_6 + "_1"].id;
                _loc_9 = this.cfgHeroLimit[_loc_8].limit;
                _loc_10 = this.cfgHeroLimit[_loc_8].limit2;
                _loc_11 = [];
                _loc_12 = [];
                _loc_13 = [];
                _loc_14 = [];
                var _loc_23:Boolean = false;
                FaShenUtil.dadao2 = false;
                FaShenUtil.dadao1 = _loc_23;
                if (_loc_9)
                {
                    if (_loc_9.search("&") != -1)
                    {
                        _loc_12 = _loc_9.split("&");
                        _loc_17 = 0;
                        while (_loc_17 < _loc_12.length)
                        {
                            
                            _loc_11.push((_loc_12[_loc_17] as String).split("#"));
                            _loc_17++;
                        }
                    }
                    else
                    {
                        _loc_18 = _loc_9.split("#");
                        _loc_11.push(_loc_18);
                    }
                }
                if (_loc_10)
                {
                    if (_loc_10.search("&") != -1)
                    {
                        _loc_14 = _loc_10.split("&");
                        _loc_19 = 0;
                        while (_loc_19 < _loc_14.length)
                        {
                            
                            _loc_13.push((_loc_14[_loc_19] as String).split("#"));
                            _loc_19++;
                        }
                    }
                    else
                    {
                        _loc_20 = _loc_10.split("#");
                        _loc_13.push(_loc_20);
                    }
                }
                _loc_15 = FaShenUtil.showLimit(_loc_11, 0, this.jihuoHeros);
                _loc_16 = FaShenUtil.showLimit2(_loc_13, 0, this.jihuoHeros);
                if (_loc_16 == "")
                {
                    if (FaShenUtil.dadao1 == true)
                    {
                        _loc_5 = true;
                        break;
                    }
                    continue;
                }
                if (FaShenUtil.dadao1 == true || FaShenUtil.dadao2 == true)
                {
                    _loc_5 = true;
                    break;
                }
            }
            _loc_7 = this.btnDic["fashen"];
            if (_loc_5)
            {
                if (_loc_7)
                {
                    _loc_7.addEffect();
                }
            }
            else if (_loc_7)
            {
                _loc_7.deleteEffect();
            }
            return;
        }// end function

        public function showEffect(param1:Object) : void
        {
            var _loc_2:* = this.btnDic[param1.ab];
            if (_loc_2)
            {
                if (param1.state)
                {
                    _loc_2.addEffect();
                }
                else
                {
                    _loc_2.deleteEffect();
                }
            }
            else
            {
                this.delayMsg[param1.ab] = param1;
            }
            return;
        }// end function

        public function updateJuHunZhu(param1:Object) : void
        {
            var _loc_2:* = this.btnDic["juhunzhu"];
            if (_loc_2)
            {
                _loc_2.update(param1);
            }
            else
            {
                this.delayMsg["juhunzhu"] = param1;
            }
            return;
        }// end function

        private function yeqian(param1:Object) : Boolean
        {
            var _loc_2:Boolean = false;
            if (int(param1.opentime) <= this.serveropenday && int(param1.overtime) >= this.serveropenday)
            {
                _loc_2 = true;
            }
            else
            {
                _loc_2 = false;
            }
            return _loc_2;
        }// end function

        public function removeLeaf(param1:String) : void
        {
            var _loc_2:Object = null;
            var _loc_3:ActiveButton = null;
            for each (_loc_2 in this.btnArr)
            {
                
                if (_loc_2.leaf)
                {
                    if (_loc_2.leaf.indexOf(param1) >= 0)
                    {
                        _loc_3 = this.btnDic[_loc_2.name];
                        if (_loc_3 != null)
                        {
                            _loc_3.removeLeaf(param1);
                        }
                    }
                }
            }
            return;
        }// end function

        public function checkMRSCShow() : void
        {
            var _loc_1:* = this.btnDic["shouchong"];
            if (_loc_1 == null)
            {
                _loc_1 = this.btnDic["mrlc"];
                if (_loc_1 == null)
                {
                    this.addBtn("mrlc");
                }
            }
            return;
        }// end function

        public function updateHuoDongEffect(param1:Object) : void
        {
            var _loc_2:Boolean = false;
            if (this.abState[param1.name] == null)
            {
                this.abState[param1.name] = new Dictionary();
            }
            this.abState[param1.name][param1.page] = param1.state;
            for each (_loc_2 in this.abState[param1.name])
            {
                
                if (_loc_2 == true)
                {
                    this.showEffect({ab:param1.name, state:true});
                    return;
                }
            }
            this.showEffect({ab:param1.name, state:false});
            return;
        }// end function

    }
}
